#!/usr/bin/env python3
# -*- encoding: utf-8 -*-
import numpy as np
import matplotlib.pyplot as plt


f = open("data.dat", "r")
x = []
y1 = []
y2 = []
while True:
    buffer = f.readline()
    if not buffer:
        break
    [xt, y1t, y2t] = buffer.split(sep=',')
    x.append(float(xt))
    y1.append(float(y1t))
    y2.append(float(y2t))
x = np.array(x)
y1 = np.array(y1)
y2 = np.array(y2)
plt.figure(1, [8, 6])
lab1 = "$\\frac{dy}{dx}=y^2\\cos x$"
lab2 = "$y=\\frac{1}{1-\\sin x}$"
plt.subplot(2, 1, 1)
plt.plot(x, y1, label=lab1, linewidth=2.0)
plt.legend(prop={"size": 18})
plt.subplot(2, 1, 2)
plt.plot(x, y2, label=lab2, linewidth=2.0)
plt.legend(prop={"size": 18})
# plt.savefig("data.png", form="png")
plt.show()
